import { defineNuxtPlugin, useState } from "#app";
import { ID_INJECTION_KEY } from "element-plus/lib";

export default defineNuxtPlugin(nuxt => {
  const prefix = useState("element-plus-id-prefix", () =>
    Math.floor(Math.random() * 1e4)
  );
  nuxt.vueApp.provide(ID_INJECTION_KEY, {
    prefix: prefix.value,
    current: 0
  });
});
